<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	May 22, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/candidates/tmpl/cvuploadcopyandpast.php
 ^ 
 * Description: candidate action
 ^ 
 * History:		NONE
 ^ 
 */
  defined('_JEXEC') or die('Restricted access');
  global $mainframe;
  $document =& JFactory::getDocument();

  /* $document->addScript( 'components/com_wrecruit/js/jquery-1.7.2.min.js' );
  $document->addScript( 'components/com_wrecruit/js/jquery-ui.min.js' );
  $document->addScript( 'components/com_wrecruit/js/jquery.uniform.js' );
  $document->addScript( 'components/com_wrecruit/js/scripts.js' );*/
  $document->addScript( 'components/com_wrecruit/js/popup.js' );
   $document->addStyleSheet('components/com_wrecruit/css/popup.css');
  $document->addStyleSheet('components/com_wrecruit/css/chosen/chosen.css');
  $candidate = $this->getModel('wrecruit', 'WRecruitModel');
  $user	=& JFactory::getUser();
  if(isset($user->id) && $user->id == 0 || $user->id == ''){
	   $app =& JFactory::getApplication(); 
	   $app->enqueueMessage( JText::_( 'Please <a href="index.php?option=com_users&view=login">Login</a>' ), 'Login access' );
	  return;
  }else{
  	$candidateObj = $candidate->getAllCandidatesInfor($user->id);
	if( !$candidateObj ){
		$app =& JFactory::getApplication(); 
       //add a message to the message queue
        $app->enqueueMessage( JText::_( 'Please <a href="index.php?option=com_users&view=login">Login</a>' ), 'Login access' );

		return;
	}
	
   }
   $com_base = "components/com_wrecruit/";
   
  //Registric resume access
  if(!$candidate->checkAuticationResume($user->id,JRequest::getVar('id'))){
	  $session = &JFactory::getSession();
	  $msg = $session->get('job_msg');
	  echo $msg;
	  return;
  }

$editor =& JFactory::getEditor('tinymce');
?>
<div class="box-list-job">
					<div class="job-seeker-panel">
						<?php include('components/com_wrecruit/views/candidates/tmpl/menuLeft.php');?>
					</div>
					<div class="job-seeker-right">
						<div class="head-title">
						<h2>Upload or Copy and paste your CV</h2>
						</div>
					<?php
					if ($data = $candidate->getCvViewInfoById(JRequest::getVar('id')) ) {
					 if( $data->RESUME_TYPE !=1 ){ 
						echo "Does not valide cv type!";
						}else{	
						 $params = array('theme' => 'simple');
						 $resumeInfo = $candidate->getCvInfoById(JRequest::getVar('id'));
						 
					?>
							<form action="#" method="post" enctype="multipart/form-data">
							<div class="divupload-cv">
						
								<div>
                                    <div style="float:left;">Browser your CV here: </div>

                                           
                                    <div class="browsecv">
                                        <div class="fakeuploadbutton">&nbsp;&nbsp;&nbsp;</div>
                                        <input id="file" type="file" name="resumefile"  id="upload-cv" class="file"/>
                                    </div>
                                    <script type="text/javascript" charset="utf-8">
                                        jQuery('#file').css('opacity',0);    
                                    </script>								
                            <!--<input type="submit" value=""  id="cv" style="	width: 105px;	height:29px;	margin:15px;background-image: url(components/com_wrecruit/images/upload-cv.gif); background-repeat: no-repeat;	background-position: center right;	border:none;" />-->
                                    <div style="float:left;">(Max file size 2MB, only file word, PDF accepted)</div>
                            
                                	</div>
								
                                    <div class='orcv'>-OR-</div>
                                    <div style="width:520px;"><p>Copy and paste your CV in the editor below:</p>
								<?php 
									echo $editor->display('cv_content', $resumeInfo['filecontent'], '500', '200', '60', '20', false,$params);
								?>
							</div>
						                       <!--<textarea name="copy-past-cv" id="copy-past-cv">Mini text editor with simple text format...</textarea>-->
                        
                         	<div class="wrapp-btn">
                           		<span class="btn-left"><span class="btn-right"><input type="submit" value="Save" id="save-copy-cv" class="btn"/>&nbsp;</span></span>
                       		</div>
                       </div>
                           <input type="hidden" value="<?php echo JRequest::getVar('id');?>" name="id">
                           <input type="hidden" value="cvuploadcopyandpast" name="layout">
                           <input type="hidden" value="com_wrecruit" name="option">
                           <input type="hidden" value="candidateUploadCv" name="task">
                           <input type="hidden" value="candidates" name="view" />
                           <input type="hidden" value="<?php echo $candidateObj->uid;?>" name="uid">
                       </form>	
					 <?php 
						}//End check
					 }
					 ?>
					</div>
				</div>
				
				<!--<div class="box-banner-bottom">					
					<img src="components/com_wrecruit/images/banner-avertise-bottom.jpg" alt="" title="" width="745" height="122" />
				</div>-->
	<!--popup content-->
        <div id="popupContainer" class="hidden" style="text-align:left;">
            <a id="close" class="hidden" title="close popup"></a>   
            <center>
            <form action="index.php" method="post">
            <table border="0">
            	<tr>
                	<td><input type="text" class="text" value="<?php echo $candidateObj->EMAIL;?>" name="mails" /></td>
                    <td></td>
                </tr>
                <tr>
                	<td colspan="2" align="right">
                    	<div class="wrapp-btn">
                            <span class="btn-left"><span class="btn-right"><input type="submit" value="Save" id="" class="btn"/>&nbsp;</span></span>
                        </div>
                    
                  </td>
                </tr>
            </table>
            </form>
            </center>
             
        </div>
        <div id="overlayEffect">
        </div>
       <!--end popup content--> 